home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / ints.zip / INTS.ASM < prev    next >
Assembly Source File  |  1988-02-21  |  4KB  |  246 lines

  1. PAGE 60,132
  2. TITLE INTS.ASM - A program to list interrupt vectors
  3. ;INTS.ASM
  4. ; This program should list the interrupt vectors found in page zero.
  5. ; It runs under DOS 3.2, and should work with all 3.x versions -
  6. ; I think that the only thing that makes it version dependent is the
  7. ; terminate with return code function.
  8. ;
  9. ; Steve Conklin - 12/6/86
  10. ; uunet!ingr!tesla!steve
  11. ; Intergraph Corp. (205) 772-6888
  12. ;
  13. ;
  14. CRLF    EQU    0D0AH
  15.  
  16. DATA_SEG    SEGMENT
  17.  
  18. XLAT_TABLE    DB    '0123456789ABCDEF'
  19.  
  20. HEADER        DB    'Listing of interrupt vectors for MS-DOS'
  21.         DW    CRLF
  22.         DW    CRLF
  23.         DB    'Vectors containing 0000:0000 will not be listed.'
  24.         DW    CRLF
  25.         DW    CRLF
  26.         DB    'INT   VECTOR'
  27.         DW    CRLF
  28.         DB    '---   ------'
  29.         DW    CRLF 
  30.         DB    '$'
  31.  
  32. INT_MSG        DB    ' '
  33. INT_VAL        DB    'XX'
  34.         DB    ' - '
  35. VEC_SEG        DB    'XXXX:'
  36. VEC_OFF        DB    'XXXX'
  37.         DB    '$'
  38.  
  39. IRET_MSG    DB    ' --> IRET'
  40.         DB    '$'
  41.  
  42. DATA_SEG    ENDS
  43.  
  44.  
  45. CODE_SEG    SEGMENT
  46.     ASSUME    CS:CODE_SEG,DS:DATA_SEG
  47.  
  48. START:
  49.  
  50.     MOV    AX,DATA_SEG        ;set up data segment register
  51.     MOV    DS,AX
  52.  
  53.     MOV    DX,OFFSET HEADER    ;offset of sign-on
  54.     MOV    AH,09H            ;request 09 - send string to std out
  55.     INT    21H            ;print it
  56.  
  57.  
  58.     MOV    AL,00            ;start with int vector 00
  59.  
  60. DO_IT:
  61.  
  62.     MOV    AH,35h            ;int 21h request 35h - return vector
  63.     MOV    DI,OFFSET INT_VAL    ;Put INT value in string
  64.     CALL    BYTEHEX            ;
  65.  
  66.     INT    21H
  67.  
  68.     PUSH    AX            ;see if vector is 0000:0000
  69.     PUSH    ES            ;and don't print it if it is
  70.     POP    AX            ;
  71.     CMP    AX,0000H        ;
  72.     JNE    O_K            ;
  73.     MOV    AX,BX            ;
  74.     CMP    AX,0000H        ;
  75.     JNE    O_K            ;
  76.     POP    AX            ;
  77.     JMP    SKIP_IT            ;
  78. O_K:    POP    AX            ;
  79.  
  80.     PUSH    AX
  81.  
  82.     MOV    AX,ES            ;get vector CS in AX
  83.     MOV    DI,OFFSET VEC_SEG    ;convert and put in string
  84.     CALL    BINHEX            ;
  85.  
  86.     MOV    AX,BX            ;get vector IP in AX
  87.     MOV    DI,OFFSET VEC_OFF    ;convert and put in string
  88.     CALL    BINHEX            ;
  89.  
  90.     MOV    AH,09H            ;print string to std out
  91.     MOV    DX,OFFSET INT_MSG
  92.     INT    21H            ;print it
  93.  
  94. ;see if vector points to an IRET, and print something if it does.
  95.  
  96.     MOV    AX,ES:[BX]        ;get the word at ES:BX
  97.     CMP    AL,0CFH            ;IRET is CF hex
  98.     JNE    FINI
  99.     MOV    AH,09H            ;print string to std out
  100.     MOV    DX,OFFSET IRET_MSG
  101.     INT    21H            ;print it
  102.  
  103. ;finish up
  104.  
  105. FINI:
  106.     CALL    SEND_CRLF        ;print a newline
  107.  
  108.     POP AX
  109.  
  110. SKIP_IT:
  111.     CMP    AL,255
  112.     JE    DONE
  113.     INC    AL
  114.     JMP    DO_IT
  115. DONE:
  116.     MOV    AH,4CH            ;terminate process
  117.     MOV    AL,00H            ;normal return code
  118.     INT    21H
  119.     
  120.  
  121.  
  122. ; SEND_CRLF will send a carriage return and line feed to std out
  123.  
  124. SEND_CRLF    PROC    NEAR
  125.  
  126.     PUSH    AX
  127.     PUSH    DX
  128.  
  129.     MOV    AH,02H            ;send char to active display
  130.     MOV    DL,0DH            ;carriage return
  131.     INT    21H            ;do it
  132.     MOV    DL,0AH            ;line feed
  133.     INT    21H            ;do it
  134.  
  135.     POP    DX
  136.     POP    AX
  137.  
  138.     RET
  139.  
  140. SEND_CRLF    ENDP
  141.  
  142.  
  143.  
  144. ; BINHEX will take the value in AX and convert it into four hex ASCII
  145. ; bytes and put them at the location given in DS:DI, MSB first.
  146.  
  147. BINHEX    PROC    NEAR
  148.  
  149.     PUSH    BX
  150.     PUSH    CX
  151.     PUSH    DX
  152.     PUSH    ES
  153.     PUSH    AX
  154.     PUSH    AX
  155.  
  156.     MOV    AX,DS        ;ES is segment for string store instruction
  157.     MOV    ES,AX        ;so copy DS there
  158.     POP    AX
  159.  
  160.     MOV    BX,OFFSET XLAT_TABLE    ;set up for translation
  161.     CLD                ;make sure direction is set to inc DI
  162.  
  163.  
  164.     MOV    DX,AX        ;save a copy
  165.  
  166.     MOV    AL,DH        ;then get the high byte into AL
  167.     MOV    CL,4        ;and shift the most sig. nybble into
  168.     SHR    AL,CL        ;the low nybble of AL (SHR shifts in zeros)
  169.     XLAT    XLAT_TABLE    ;do the translation
  170.     STOSB            ;move AL to ES:DI
  171.     
  172.     MOV    AL,DH        ;get a copy of the next nybble into AL
  173.     AND    AL,0FH        ;and isolate it
  174.     XLAT    XLAT_TABLE
  175.     STOSB
  176.  
  177.     MOV    AL,DL        ;third nybble
  178.     MOV    CL,4        ;shift it
  179.     SHR    AL,CL
  180.     XLAT    XLAT_TABLE
  181.     STOSB
  182.  
  183.     MOV    AL,DL        ;least significant nybble
  184.     AND    AL,0FH        ;isolate
  185.     XLAT    XLAT_TABLE
  186.     STOSB
  187.  
  188.     POP    AX
  189.     POP    ES
  190.     POP    DX
  191.     POP    CX
  192.     POP    BX
  193.  
  194.     RET
  195.  
  196. BINHEX    ENDP
  197.  
  198.  
  199. ; Bytehex will take the value in AL and convert it into two hex ASCII
  200. ; bytes and put them at the location given in DI, MSB first.
  201.  
  202. BYTEHEX    PROC    NEAR
  203.  
  204.     PUSH    BX
  205.     PUSH    CX
  206.     PUSH    DX
  207.     PUSH    ES
  208.     PUSH    AX
  209.     PUSH    AX
  210.  
  211.     MOV    AX,DS        ;ES is segment for string store instruction
  212.     MOV    ES,AX        ;
  213.     POP    AX
  214.  
  215.     MOV    BX,OFFSET XLAT_TABLE    ;set up for translation
  216.     CLD                ;make sure direction is set to inc DI
  217.  
  218.  
  219.     MOV    DX,AX        ;save a copy
  220.  
  221.     MOV    AL,DL        ;first nybble
  222.     MOV    CL,4        ;shift it
  223.     SHR    AL,CL
  224.     XLAT    XLAT_TABLE
  225.     STOSB
  226.  
  227.     MOV    AL,DL        ;last nybble
  228.     AND    AL,0FH        ;isolate
  229.     XLAT    XLAT_TABLE
  230.     STOSB
  231.  
  232.     POP    AX
  233.     POP    ES
  234.     POP    DX
  235.     POP    CX
  236.     POP    BX
  237.  
  238.     RET
  239.  
  240. BYTEHEX    ENDP
  241.  
  242.  
  243.     CODE_SEG    ENDS
  244.     END    START        ;Make sure we start at "START" first time.
  245.  
  246.